<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>query - Database - Prails API Documentation</title>
    </head>
    <body>
        <h3 class="P4"><a name="_SqlQuery"><span/></a>query</h3><h4 class="Heading_20_4"><a name="_Description_"><span/></a>Description:</h4>
        <p class="Text_20_body">
            Sends a query to the database and returns it's result.
        </p>
        <h4 class="Heading_20_4"><a name="_Syntax_"><span/></a>Syntax:</h4>
        <p class="Text_20_body">
            <code>
                Array query($str_query)
            </code>
        </p>
        <table border="0" cellspacing="0" cellpadding="0" class="Table16">
            <colgroup>
                <col width="104"/><col width="639"/>
            </colgroup>
            <tr>
                <td style="text-align:left;width:2.369cm; " class="Table16_A1">
                    <p class="Table_20_Contents">
                        $str_query
                    </p>
                </td>
                <td style="text-align:left;width:14.63cm; " class="Table16_B1">
                    <p class="Table_20_Contents">
                        The complete SQL query to be sent to the database.
                    </p>
                </td>
            </tr>
        </table>
        <p class="Text_20_body">
        	HINT: note that you need to add the table's prefix manually (which is always "tbl_"). 
        </p>
        <h4 class="Heading_20_4"><a name="_Example_"><span/></a>Example:</h4><pre>
            $arr_result = $this->query("SELECT * FROM tbl_user LEFT JOIN tbl_story ON fk_user_id=user_id WHERE NOT ISNULL(photo)");
        </pre>
        <p class="Text_20_body"><code>$arr_result</code> will look like this:
        </p>
        <pre>
            $arr_result = Array(
                0 => Array(
                    "user_id" => "4",
                    "photo" => "test.jpg",
                    "story_id" => "",
                    "fk_user_id" => "",
	                "title" => ""
               ),
               1 => Array(
                    "user_id" => "19",
                    "photo" => "mypicture.jpg",
                    "story_id" => "25",
                    "fk_user_id" => "19",
                    "title" => "My Test Story"    
               ),
               ...
            );
		</pre>
    </body>
</html>
